package com.reider.log4AS3.layouts.converters
{
	import com.reider.log4AS3.dataholder.Log;
	
	public class TimeConverter extends Converter
	{
		override public function convert(log:Log):String
		{
			var time:Date = log.time
			
			var result:String = fd(time.hours)+":"+fd(time.minutes)+":"+fd(time.seconds)+","+fd3(time.milliseconds)
			
			return result
		} 
		
		
		private function fd(num:Number):String
		{
			return String(num < 10? "0"+num : num)
		}
		
		private function fd3(num:Number):String
		{
			if(num < 10){
				return "00"+num
			}else if(num < 100){
				return "0"+num
			}else{
				return String(num)
			}
		}

	}
}